#include "udp_client.hpp"
#include<iostream>

int main(int argc,char* argv[])
{
	if(argc != 3)
	{
		std::cout<<"./dict_client [ip] [port]"<<std::endl;
		return 1;
	}
	UdpClient client(argv[1],atoi(argv[2]));
	while(1)
	{
		std::string word;
		std::cout<<"请输入您要查的单词: ";
		std::cin>>word;
		if(!std::cin)
		{
			std::cout<<"Good Bye"<<std::endl;
			break;
		}
		client.Sendto(word);
		std::string result;
		client.Recvfrom(&result);
		std::cout<<word<<" 意思是 "<<result<<std::endl;
	}
	return 0;
}
